        function get(api,method,data){
                var json_data = JSON.stringify(data);
                var params = {"__m" : method, "__d" : json_data};
                var my_url = "/lib/" + api;
                var retVal = null;
                $.ajax({url: my_url,async: false,data: params,success: ret});
                function ret(data){
                        console.log(data);
                        retVal = eval("(" + data +  ")");
                }
                return retVal;
        }

        function write(s){
                var str = s + "<br />\n";
                $('.test').append(str);
        }
	function helperLogin(admin){
        	var pw = "aaaa";
		a = typeof(a) != 'undefined' ? a : true;
        	if(admin == true){
                	var userName = "smoj33@gmail.com";
        	}
        	else{
                	var userName = "test@test.com";
			var pw = "test";
        	}
        	var h_pw = hex_md5(pw);
        	var info = {"email" : userName,"password" : h_pw, "remember" : 1}
        	var ret = get("userApi.php","login",info);
        	return ret;
	}
	function helperLogout(){
        	var info = {}
        	var ret = get("userApi.php","logout",info);
        	return ret;
	}
	function helperGetInfo(){
		var info = {}
		var ret = get("userApi.php","getInfo",info);
		return ret;
	}
	function helper2AddSticky(release_id){
         var info = {
                "category" : "story",
                "state_id" : 1,
                "priority_id": 1,
                "release_id": release_id,
                "note": "This is a test",
                "title": "Title here",
                "color": "#FFFFFF",
                "severity_id" : 1,
                "defect_state_id" : 0
        }
        var ret = get("stickyApi.php","addSticky",info);
        return ret.sticky_id;
}


